<?php

namespace Home\Controller;

use Think\Controller;

class SetController extends BaseController
{
    public function lst()
    {
        $user_id = session('user_id');
        $userData = M('Admin')->find($user_id);
        $shouid = explode(',', $userData['shouye']);

        $role = M('Admin_role')->where("admin_id=$user_id")->find();
        $show_index = M('Role')->find($role['role_id']);
        $data = D('setindex')->select($show_index['show_index']);

        $this->assign('data', $data);
        $this->assign('shouid', $shouid);
//        echo get_client_ip();
        $this->display();
    }

    public function updateData()
    {
        $data['shouye'] = I('post.ids');
        $data['id'] = session('user_id');
        $res = M('Admin')->save($data);
        if ($res) {
            show(1, '信息更改成功', '');
        }
    }
}